<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>弹性盒子</title>
    <style>
        .box {
            width: 500px;
            height: 500px;
            border: 2px solid black;
            margin: 100px auto;
            display: flex; /*显示为弹性盒子*/
            flex-wrap: wrap; /*换行*/
            flex-direction: row;
            align-content: flex-start;/*控制换行后的行间距*/
        }

        .box div {
            width: 100px;
            height: 100px;
            border: 1px dashed red;
        }
    </style>
</head>
<body>
<!--
   如果有太多元素超出容器，它们会溢出而不会换行
   如果一些元素比其他元素高，那么元素会沿交叉轴被拉伸来填满它的大小
-->
<div class="box">
    <div>1111</div>
    <div>2222</div>
    <div>3333</div>
    <div>4444</div>
    <div>5555</div>
    <div>6666</div>
    <div>7777</div>
    <div>8888</div>
    <div>5555</div>
    <div>6666</div>
    <div>7777</div>
    <div>8888</div>
</div>
</body>
</html>